package com.whity.towerdefense.controler.states;

import com.whity.towerdefense.TowerDefenseActivity;
import com.whity.towerdefense.Utils;

import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import com.whity.towerdefense.R;
import com.whity.towerdefense.controler.GameControler;
import com.whity.towerdefense.controler.I_State;

public class ActionPhase implements I_State
{
	// =============================================================
	// Private attributs :
	
	private static final String		TAG = "com.djm.test03.controler.states";
	
	// =============================================================
	// Public functions :
	
	public ActionPhase(String p_Level)
	{
		Utils.TRACKER.trackPageView("/ActionPhase");
		
		// Initialisation of the game
		GameControler.GAME_MODEL.LoadLevel(p_Level);
		
		// Put the game screen in the view of the phone
		TowerDefenseActivity.ACTIVITY.ChangeLayout(R.layout.action_phase);
		
	}
	
	public void OnChangeState()
	{
		if(!Utils.TRACKER.dispatch())
		{
			Log.w(TAG, "Can't dispatch Google analytics Event");
		}
		
		// Initialisation is done, go to the idle game state
		GameControler.SetState(new IdleAP());
	}
	
	public void OnTouchEvent(MotionEvent p_Evt)
	{
		
	}

	public void OnClickEvent(View p_View)
	{
		
	}
	
	public void OnDrawerOpenEvent()
	{
		
	}
	
	public void OnDrawerCloseEvent()
	{
		
	}
	
	public void OnPause()
	{
		// Pause the game :
		GameControler.GAME_MODEL.Pause();
		
		// TODO : Save the game
	}
	
	public void OnResume()
	{
		GameControler.GAME_MODEL.Resume();
	}
	
	public boolean OnMotionEvent(View p_View, MotionEvent p_Evt)
	{
		return false;
	}
	
	// =============================================================
}
